Page({

  /**
   * 页面的初始数据
   */
  data: {
    orderList: [],
    loading:true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getList()
  },
  getList(){
    wx.cloud.callFunction({
      name:"order",
      data:{
        type:"selectByOrder"
      }
    }).then(res=>{
      console.log(res.result.data)
      const objects=res.result.data
      const pids = objects.map(obj => obj.pid);
      console.log(pids)
     pids.map(pid => this.getInfo(pid));
    })
},
getInfo(pid){
  console.log(pid)
  wx.cloud.callFunction({
    name:"shop",
    data:{
      type:"selectById",
      id:pid
    }
  }).then(res=>{
    console.log(res)
    this.data.orderList.push(res.result.data)
    this.setData({
      orderList:this.data.orderList,
      loading:false
    })
  }
    )

}
 
})